import {tableData2, tableData3 } from './js/table'
export default {
    name: "declarationAudit",
    data () {
        return {
            imgList: [
                {
                    id: 0,
                    icon: require('@/assets/images/search.png'),
                    iconActive: require('@/assets/images/search-active.png')
                }
            ], // 图标集合
            navList: [
                { id: 1, name: '待审核' },
                { id: 2, name: '已审核' },
            ], // 导航集合
            hoverIndex: -1, // 头部当前hover图标
            currentNav: '', // 当前导航
            currentTable: '', // 当前table
            // 列表数据
            tableData1: [],
            tableData2: [],
            tableData3: [],
            rejectForm:{
            	textarea:""//驳回理由
            },
            rejectDialogVisible: false,//驳回弹框是否显示
            curIndex:-1,//当前操作索引
            curObj:{},//当前操作数据
        }
    },
    mounted () {
        this.tableData2 = tableData2;
        this.tableData3 = tableData3;
    },
    methods: {
    	/*驳回理由*/
    	rejectDialog:function(){
    		this.rejectDialogVisible=false;
    		this.tableData2.splice(this.curIndex, 1);
            this.tableData3.unshift(this.curObj);
            this.$message({
                type: 'success',
                message: '驳回成功!'
            });
    		
    	},
    	/*显示驳回弹框*/
    	rejectFn:function(row,index){
    		this.curIndex=index;
    		this.curObj=row;
    		this.rejectDialogVisible=true;
    	},
        /**
         * 头部图标点击时触发
         * @param id
         */
        iconClick (row,index) {
            this.$confirm('您确定要通过这条记录?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                    this.tableData2.splice(index, 1);
                    this.tableData3.unshift(row);
                    this.$message({
                        type: 'success',
                        message: '通过成功!'
                    });
                }
            ).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消通过'
                });
            });
        },
        /**
         * 导航切换
         * @param index
         */
        switchNav (index) {
            this.currentNav = index
        },
    }
}
